import { createRequest } from '/@/api/service';
const module = 'ib/flowpath/v1/AppFlowpathRecordApi/';
/**
 * 查询审批列表
 */
function QUERY_APP_FLOW_PATH_RECORD_LIST(
  data: FlowPathApi.QueryFlowpathRecordListReq,
  header: object = {},
): Promise<FlowPathApi.QueryFlowpathRecordListResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}queryAppFlowpathRecordList`,
    data,
    header,
    'POST',
  );
}

/**
 * 查看审批详情
 */
function QUERY_APP_FLOW_PATH_RECORD_DETAIL(
  data: FlowPathApi.QueryFlowpathRecordDetailReq,
  header: object = {},
): Promise<FlowPathApi.QueryFlowpathRecordDetailResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}queryAppFlowpathRecordDetail`,
    data,
    header,
    'POST',
  );
}

/**
 * 审批拒绝
 */
function REJECT_APP_FLOW_PATH_RECORD(
  data: FlowPathApi.AddFlowpathRecordApproveReq,
  header: object = {},
): Promise<FlowPathApi.AddFlowpathRecordApproveResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}rejectAppFlowpathRecord`,
    data,
    header,
    'POST',
  );
}

/**
 * 审批同意
 */
function ACCEPT_APP_FLOW_PATH_RECORD(
  data: FlowPathApi.AddFlowpathRecordApproveReq,
  header: object = {},
): Promise<FlowPathApi.AddFlowpathRecordApproveResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}acceptAppFlowpathRecord`,
    data,
    header,
    'POST',
  );
}

/**
 * 审批撤销
 */
function CANCEL_APP_FLOW_PATH_RECORD(
  data: FlowPathApi.AddFlowpathRecordApproveReq,
  header: object = {},
): Promise<FlowPathApi.AddFlowpathRecordApproveResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}cancelAppFlowpathRecord`,
    data,
    header,
    'POST',
  );
}

/**
 * 新增审批
 */
function INSERT_APP_FLOW_PATH_RECORD(
  data: FlowPathApi.InsertFlowpathRecordReq,
  header: object = {},
): Promise<FlowPathApi.InsertFlowpathRecordResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}insertAppFlowpathRecord`,
    data,
    header,
    'POST',
  );
}

/**
 * 查询审批列表总数
 */
function QUERY_APP_FLOW_PATH_RECORD_COUNT(
  data: FlowPathApi.QueryFlowpathRecordListReq,
  header: object = {},
): Promise<FlowPathApi.QueryAppFlowpathRecordCountResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}queryAppFlowpathRecordCount`,
    data,
    header,
    'POST',
  );
}

/**
 * 审批催办发送ding消息
 */
function URGING(
  data: FlowPathApi.FlowpathUrgingReq,
  header: object = {},
): Promise<FlowPathApi.FlowpathUrgingResp> {
  return createRequest(`${process.env.APP_API_URL}${module}urging`, data, header, 'POST');
}

export {
  QUERY_APP_FLOW_PATH_RECORD_LIST,
  QUERY_APP_FLOW_PATH_RECORD_DETAIL,
  REJECT_APP_FLOW_PATH_RECORD,
  ACCEPT_APP_FLOW_PATH_RECORD,
  CANCEL_APP_FLOW_PATH_RECORD,
  INSERT_APP_FLOW_PATH_RECORD,
  QUERY_APP_FLOW_PATH_RECORD_COUNT,
  URGING,
};
